package com.songhq;

import org.apache.catalina.Context;
import org.apache.catalina.connector.Connector;
import org.apache.tomcat.util.descriptor.web.SecurityCollection;
import org.apache.tomcat.util.descriptor.web.SecurityConstraint;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

import com.songhq.zonghe.test.ITestService;

@SpringBootApplication
@EnableAspectJAutoProxy(proxyTargetClass = true)
public class ZongHeApplication {
//	@Bean
//    public EmbeddedServletContainerFactory servletContainer() {
//        TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory() {
//            @Override
//            protected void postProcessContext(Context context) {
//                SecurityConstraint constraint = new SecurityConstraint();
//                constraint.setUserConstraint("CONFIDENTIAL");
//                SecurityCollection collection = new SecurityCollection();
//                collection.addPattern("/*");
//                constraint.addCollection(collection);
//                context.addConstraint(constraint);
//            }
//        };
//        tomcat.addAdditionalTomcatConnectors(httpConnector());
//        return tomcat;
//    }
//
//    @Bean
//    public Connector httpConnector() {
//        Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
//        connector.setScheme("http");
//        //Connector监听的http的端口号
//        connector.setPort(9089);
//        connector.setSecure(false);
//        //监听到http的端口号后转向到的https的端口号
//        connector.setRedirectPort(9090);
//        return connector;
//    }

	//@Value("${attribute}")
	private String attribute;
	
	@Autowired
	private ITestService iTestService;
	
	public static void main(String[] args) {
		SpringApplication.run(ZongHeApplication.class, args);
	}
	//AspectJAutoProxyBeanDefinitionParser
	//sun.misc.Launcher
	//String
	//AppClassLoader
	//ConfigurableWebApplicationContext
	//ConfigurationWarningsApplicationContextInitializer
	//EventPublishingRunListener
	//ConfigFileApplicationListener
	//DelegatingApplicationListener
	//BackgroundPreinitializer
	//LoggingApplicationListener
	//FileEncodingApplicationListener
	//PropertySourcesPropertyResolver
	//DefaultListableBeanFactory
	//ConfigurationClassPostProcessor
	//DependsOn
	//Class
	//Modifier
	//Supplier
	//RootBeanDefinition
	//PropertySourcesPlaceholderConfigurer  、ConfigurationClassPostProcessor
	//PropertySourcesPlaceholderConfigurer的静态工厂为
	//org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration PropertyPlaceholderAutoConfiguration
	//Method
	public String getAttribute() {
		return attribute;
	}


	public void setAttribute(String attribute) {
		this.attribute = attribute;
	}
	
	
}
